import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  // 1. 重定向
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: 'login',
    component: () => import('../views/Login')
  },
  // 首页
  {
    path: '/home',
    name: 'Home',
    component: () => import('../views/home'),
    meta: {
      title: '地址'
    }
  },
  // 搜索
  {
    path: '/search',
    component: () => import('../views/Search'),
    meta: { title: '搜索' }
  },
  // 订单
  {
    path: '/order',
    component: () => import('../views/Order'),
    meta: { title: '订单列表' }
  },
  // mine
  {
    path: '/mine',
    component: () => import('../views/mine'),
    meta: { title: '我的' }
  },

  //  2. 404,放在最后
  {
    path: '*',
    component: () => import('../views/PageNoFound')
  }
]

const router = new VueRouter({
  routes
})

export default router
